package other;

/**
 * @program: javase
 * @description:
 * @author: lld
 * @create: 2021-06-08 11:52
 **/
public class ValidPalindrome125 {
    public static void main(String[] args) {
        ValidPalindrome125 v = new ValidPalindrome125();
        char a='9';//97
        int z='z';
        System.out.println(a);
//        System.out.println(z);
        System.out.println(v.isPalindrome("a a  , . a a"));
    }

    public boolean isPalindrome(String s) {

        String s1 = s.toLowerCase();
        int left=0,right=s1.length()-1;
        while (left<right){
            while (s1.charAt(left)<'a'||s1.charAt(left)>'z'){
                left++;
            }
            while (s1.charAt(right)<'a'||s1.charAt(right)>'z'){
                right--;
            }
            if(left<right&&s1.charAt(left)==s1.charAt(right)){
                left++;
                right--;
            }else {
                return false;
            }
        }
            return true;
    }
}
